﻿<%@ Page Language="C#" MasterPageFile="~/admin/Admin.Master" AutoEventWireup="true"
    CodeBehind="TimeTable.aspx.cs" Inherits="ESCHOOL.admin.WebForm15" Title="TimeTable" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style3
        {
            width: 100%;
        }
        .style4
        {
            height: 39px;
        }
        .style5
        {
            height: 37px;
        }
        .style6
        {
            height: 30px;
        }
        .style7
        {
            height: 35px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <p>
        &nbsp;</p>
    <p>
        <br />
        <table class="style3">
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <asp:TextBox ID="tbtimetableid" runat="server" Visible="False"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style4">
                    Teacher Name
                </td>
                <td class="style4">
                    <asp:DropDownList ID="ddlteachid" runat="server" Height="22px" Width="127px" DataTextField="teacher_name"
                        DataValueField="teacher_id">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style5">
                    Class Name
                </td>
                <td class="style5">
                    <asp:DropDownList ID="ddlclassid" runat="server" Width="127px" Height="22px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style4">
                    Subject Name
                </td>
                <td class="style4">
                    <asp:DropDownList ID="ddlsubjectid" runat="server" Width="127px" Height="22px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style6">
                    Day
                </td>
                <td class="style6">
                    <asp:DropDownList ID="ddldayname" runat="server" Height="22px" Width="127px">
                        <asp:ListItem>Monday</asp:ListItem>
                        <asp:ListItem>Tuesday</asp:ListItem>
                        <asp:ListItem>Wednesday</asp:ListItem>
                        <asp:ListItem>Thrusday</asp:ListItem>
                        <asp:ListItem>Friday</asp:ListItem>
                        <asp:ListItem>Saturday</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style7">
                    Schedule
                </td>
                <td class="style7">
                    <asp:TextBox ID="tbstarttime" runat="server">Start Time</asp:TextBox>
                    <asp:TextBox ID="tbendtime" runat="server">End Time</asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ErrorMessage="hh:mm:ss" ControlToValidate="tbstarttime"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btninsert" runat="server" OnClick="btninsert_Click" Text="Insert" />
                </td>
                <td>
                    <asp:Button ID="btnupdate" runat="server" OnClick="btnupdate_Click" Text="Update" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDeleting="GridView1_RowDeleting"
                        OnRowEditing="GridView1_RowEditing" 
                        onpageindexchanging="GridView1_PageIndexChanging">
                        <Columns>
                            <asp:BoundField DataField="teacher_name" HeaderText="Teacher Name" />
                            <asp:BoundField DataField="class_name" HeaderText="Class Name" />
                            <asp:BoundField DataField="subject_name" HeaderText="Subject" />
                            <asp:BoundField DataField="dayname" HeaderText="Day" />
                            
                            <asp:TemplateField HeaderText="Start Time">
                                <ItemTemplate>
                                <%# Eval("starttime","{0:T}") %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="End Time">
                                <ItemTemplate>
                                <%# Eval("endtime","{0:T}") %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="Edit">
                                <ItemTemplate>
                                    <asp:Button ID="btnedit" runat="server" CommandArgument='<%# Eval("time_table_id") %>'
                                        CommandName="Edit" OnCommand="btnedit_Command" Style="margin-bottom: 0px" 
                                        Text="Edit" CausesValidation="False" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Delete">
                                <ItemTemplate>
                                    <asp:Button ID="btndelete" runat="server" CommandArgument='<%# Eval("time_table_id") %>'
                                        CommandName="Delete" OnCommand="btndelete_Command" Text="Delete" 
                                        CausesValidation="False" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </td>
            </tr>
        </table>
    </p>
</asp:Content>
